package edu.unf.cen6940.converter;

import java.text.ParseException;
import java.util.Locale;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.Formatter;
import org.springframework.stereotype.Component;

import edu.unf.cen6940.dao.GeneratedproductDAO;
import edu.unf.cen6940.domain.Generatedproduct;

@Component
public class GenerateproductConverter implements Formatter<Generatedproduct>{

	@Autowired
	GeneratedproductDAO generatedproductDAO;
	
	@Override
	public String print(Generatedproduct object, Locale locale) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Generatedproduct parse(String text, Locale locale)
			throws ParseException {
		return generatedproductDAO.findGeneratedproductByGeneratedProductId(Integer.parseInt(text));
	}

}
